<?php
/**
 * Created by PhpStorm.
 * userValidate: hms
 * Date: 2018/11/26
 * Time: 15:23
 */
namespace app\mini\validate;

use think\Validate;

class userValidate extends Validate
{

    protected $rule = [
        'mobile' =>  'require|checkTel:thinkphp',
        'code' =>  'require',
        'password'  =>  'require',
    ];

    protected $message = [
        'mobile.require' => '请输入手机号',
        'code.require' => '请输入验证码',
        'password.require' => '请输入密码',
    ];

    public function checkTel($value, $rule, $data = [])
    {
        return preg_match('#^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\\d{8}$#', $value) ? true : '手机号错误';
    }

}